/*************************************************************************
	> File Name: execlp.c
	> Author: Angel Criss
	> Mail: abbytsing@gmail.com 
	> Created Time: Thu 16 Jan 2014 10:33:13 AM CST
 ************************************************************************/

#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
extern char **environ;
int main(int argc, char* argv[])
{
    pid_t pid;
    if((pid=fork())<0)
    {
        printf("error, cannot creat child process\n");
        execve("/home/abby/bin/error.sh",argv,environ);
    }
    if(pid==0)
    {
        printf("this is the child process\n");
        execve("/home/abby/bin/screenfetch",argv,environ);
        sleep(15);
    }
    else
    {
        printf("this is the whole process and the ID is %ld\n\n",(long)getpid());
        printf("please wait a few seconds\n");
        sleep(25);
        execlp("/home/abby/bin/scripts/zenity-menu.sh","zenity-menu.sh",(char*)NULL);
    }
}
